<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>赖派天机四柱生成系统</title>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<script src='js/jquery.js'></script>
		<script src="js/GetCNDate.js"></script>
		<script src="js/Function.js"></script>
		<link href="css/CHCStyle.css" rel="stylesheet" />
		<script type="text/javascript">
			$(function() {

				UpdateDateTime();
				setInterval(function() {
					UpdateDateTime();
				}, 30000);

			})

			function UpdateDateTime() {
				var myDate = new Date;
				var year = myDate.getFullYear(); //获取当前年
				var mon = myDate.getMonth() + 1; //获取当前月
				var date = myDate.getDate(); //获取当前日
				var h = myDate.getHours(); //获取当前小时数(0-23)
				var m = myDate.getMinutes(); //获取当前分钟数(0-59)
				var s = myDate.getSeconds(); //获取当前秒
				var week = myDate.getDay();
				var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
				//console.log(year, mon, date, weeks[week],h,m,s)
				$("#time").html(year + "年" + mon + "月" + date + "日 " + weeks[week]);

				var Hour = myDate.getHours(); //获取当前小时数(0-23)
				var CNTime = " ";
				if (parseInt(Hour) >= 23 || parseInt(Hour) < 1) {
					CNTime = "子时"
				}
				if (parseInt(Hour) >= 1 && parseInt(Hour) < 3) {
					CNTime = "丑时"
				}
				if (parseInt(Hour) >= 3 && parseInt(Hour) < 5) {
					CNTime = "寅时"
				}
				if (parseInt(Hour) >= 5 && parseInt(Hour) < 7) {
					CNTime = "卯时"
				}
				if (parseInt(Hour) >= 7 && parseInt(Hour) < 9) {
					CNTime = "辰时"
				}
				if (parseInt(Hour) >= 9 && parseInt(Hour) < 11) {
					CNTime = "巳时"
				}
				if (parseInt(Hour) >= 11 && parseInt(Hour) < 13) {
					CNTime = "午时"
				}
				if (parseInt(Hour) >= 13 && parseInt(Hour) < 15) {
					CNTime = "未时"
				}
				if (parseInt(Hour) >= 15 && parseInt(Hour) < 17) {
					CNTime = "申时"
				}
				if (parseInt(Hour) >= 17 && parseInt(Hour) < 19) {
					CNTime = "酉时"
				}
				if (parseInt(Hour) >= 19 && parseInt(Hour) < 21) {
					CNTime = "戌时"
				}
				if (parseInt(Hour) >= 21 && parseInt(Hour) < 23) {
					CNTime = "亥时"
				}
				$("#Span_CNTime").html(CNTime);

				$("#Span_CNDate").html(GetLunarDay(year, mon, date));
			}
		</script>
		<style>
			.select{
				font-size: 10px;height: 25px; background-color: #FFFFFF;color: #000000;
			}
		</style>
	</head>
	<body>

		<div class="div_title" style="border-radius: 0px;">赖派天机四柱命盘生成系统</div>
		<div style="width:100%;margin:0 auto;text-align: center; background-color:#CCFFFF;line-height:30px;">
			<span id="time"></span>
			<span id="Span_CNDate"></span>
			<span id="Span_CNTime"></span>
			<input type="button" id="Btn_temp" style="display: none;" />
		</div>
		<div style="height:17px;"></div>
		<div style="font-size: 10px;text-align: center;margin: 0 auto;width:100%;">
			<select size="1" name="NewOld" id="NewOld" class="select">
				<option value='OLD'>农历</option>
				<option value='NEW'>新历</option>
			</select>
			<select size="1" name="yyyy" id='YYY' class="select">
			</select>
			<select size="1" name="mmmm" id='MMM' class="select">
			</select>
			<select size="1" name="dddd" id='DDD' class="select">
			</select>

			<select size="1" name="SHI" id='SHI' class="select">
				<option value=1>子(23-1时)</option>
				<option value=2>丑(1-3时)</option>
				<option value=3>寅(3-5时)</option>
				<option value=4>卯(5-7时)</option>
				<option value=5>辰(7-9时)</option>
				<option value=6>巳(9-11时)</option>
				<option value=7>午(11-13时)</option>
				<option value=8>未(13-15时)</option>
				<option value=9>申(15-17时)</option>
				<option value=10>酉(17-19时)</option>
				<option value=11>戌(19-21时)</option>
				<option value=12>亥(21-23时)</option>
			</select>

			<select size="1" name="xb" id="xb" class="select">
				<option value="男">男</option>
				<option value="女">女</option>
			</select>
		</div>
		<div style="height:10px;"></div>
		<div style="width: 100%;margin: 0 auto;text-align: center;">
			<input type="button" class="btn2 btn_Start" style="width: 25%;" value="生成" />
			<input type="button" class="btn btn_Clear" style="width: 25%;" value="清空" />
		</div>
		<div id='Web1'></div>
	</body>

	<script>
		$(function() {
			var myDate = new Date;
			var year = myDate.getFullYear();
			var mon = myDate.getMonth() + 1
			var options = '';
			for (i = (year - 60); i <= (year + 2); i++) {
				options = "<option value='" + i + "'>" + i + "年</option>";
				$('#YYY').append(options);
			}

			for (i = 1; i <= 12; i++) {
				options = "<option value='" + i + "'>" + i + "月</option>";
				$('#MMM').append(options);
			}

			for (i = 1; i <= 31; i++) {
				options = "<option value='" + i + "'>" + i + "日</option>";
				$('#DDD').append(options);
			}

			$(".btn_Start").click(function() {

				var NewOld = $("#NewOld option:selected").val();
				var yyyy = $("#YYY option:selected").val();
				var yue = $("#MMM option:selected").val();
				var ri = $("#DDD option:selected").val();
				var SHI = $("#SHI option:selected").val();
				var xb = $("#xb option:selected").val();
				console.log(NewOld + yyyy + yue + ri + SHI + xb);
				var Url = "http://www.chcoa.cn/bazi/BaZiAPP.asp?NewOld=" + NewOld + "&yyyy=" + yyyy + "&yue=" + yue + "&ri=" +
					ri + "&SHI=" + SHI + "&xb=" + xb;

				//window.location.href=Url;
				Url = 'http://www.chcoa.cn/bazi/baziapp.asp';

				fetch(Url, {
						method: 'POST',
						headers: {
							'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
						},
						body: 'NewOld=' + NewOld + '&yyyy=' + yyyy + '&yue=' + yue + '&ri=' + ri + '&SHI=' + SHI + '&xb=' + xb + '',
					})
					.then(response => response.text())
					.then(data => {
						console.log(data);
						//document.getElementById('Web1').innerHTML=data;
						$("#Web1").html(data);
					})



				//http://www.chcoa.cn/bazi/BaZiAPP.asp?NewOld=OLD&yyyy=1980&yue=1&ri=1&SHI=1&xb=%C4%D0
				// $.ajax({
				// 	url: Url , //'http://www.chcoa.cn/bazi/BaZiAPP.asp?NewOld=OLD&yyyy=1980&yue=1&ri=1&SHI=1&xb=%C4%D0',
				// 	type: 'get',
				// 	dataType:"json",
				// 	data:'',
				// 	jsonp:"jsoncallback",
				// 	success: function(data) {
				// 		$("#Web1").html(data); //显示返回的数据
				// 	},
				// 	error: function(e) {
				// 	  $("#Web1").html("网络异常" + e,1500);
				// 	 }
				// 	//async: false,
				// });
			})

			$(".btn_Clear").click(function() {

				window.location.href = "TaiJiShenShu.html";
			})

		})
	</script>
</html>
